<?php
/**
 * @name IndexController
 * @author 6p2b7gaqkyoe4aw\administrator
 * @desc 默认控制器
 * @see http://www.php.net/manual/en/class.yaf-controller-abstract.php
 */
error_reporting(E_ALL^E_NOTICE^E_WARNING);
class ApiController extends Yaf_Controller_Abstract {
	
	public function init(){
		//$this->_layout = Yaf_Registry::get('layout');
	}
   
	public function ArtilceAction() {
		// 		header("Content-type: text/html; charset=utf-8");
		
		$article_model=new ArticleModel();
		$id=$_REQUEST['id'] ? $_REQUEST['id'] : '';
		$catid=$_REQUEST['catid'] ? $_REQUEST['catid'] : '';
		$userid=$_REQUEST['userid'] ? $_REQUEST['userid'] : '';
		$page=$_REQUEST['page'] ? $_REQUEST['page'] : 0;
		$pagesize=$_REQUEST['pagesize'] ? $_REQUEST['pagesize'] : '';
		$article_all=$article_model->get_article($id,$catid,$userid,$page,$pagesize);
		exit(json_encode($article_all));
		//print_r($article_all);
		
	}
	
	public function CategoryAction() {
		// 		header("Content-type: text/html; charset=utf-8");
	
		$article_model=new ArticleModel();
		$catid=$_REQUEST['catid'] ? $_REQUEST['catid'] : '';
		$parentid=$_REQUEST['parentid'] ? $_REQUEST['parentid'] : '';
		$category_all=$article_model->get_category($catid,$parentid);
		exit(json_encode($category_all));
	}
	
	public function BannerAction() {
		// 		header("Content-type: text/html; charset=utf-8");
	
		$article_model=new ArticleModel();
		$baner_all=$article_model->get_banner();
		exit(json_encode($baner_all));
	}
	
	
	
	
}
